package com.sojson.project.service.impl;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.sojson.project.dao.ShippersDao;
import com.sojson.project.entity.po.Shippers;
import com.sojson.project.query.entity.bo.Select;
import com.sojson.project.service.ShippersService;

/**
 * Service实现类
 * 
 * @author liu
 * @date 2021-04-01
 */
@Service
public class ShippersServiceImpl implements ShippersService {

    @Resource
    private ShippersDao shippersDaoImpl;

    /**
     * 单条插入
     * 
     * @param shippers
     * @return
     * @throws SQLException
     */
    @Override
    public int insert(Shippers shippers) {
        int insert = shippersDaoImpl.insert(shippers);
        return insert;
    }

    /**
     * 批量插入
     * 
     * @param shippers
     * @return
     * @throws SQLException
     */
    @Override
    public int insertList(Shippers shippers) {
        int insertList = shippersDaoImpl.insertList(shippers.getShipperss());
        return insertList;
    }

    /**
     * 通过对象批量删除(物理删除)
     * 
     * @param shippers
     * @return
     * @throws SQLException
     */
    @Override
    public int deleteByDto(Shippers shippers) {
        int deleteByDto = shippersDaoImpl.deleteByDto(shippers);
        return deleteByDto;
    }

    /**
     * 统计全部数量
     * 
     * @return
     * @throws SQLException
     */
    @Override
    public int countAll() {
        int countAll = shippersDaoImpl.countAll();
        return countAll;
    }

    /**
     * 查询所有
     * 
     * @return
     * @throws SQLException
     */
    @Override
    public List<Shippers> findAll() {
        List<Shippers> findAll = shippersDaoImpl.listAll();
        return findAll;
    }

    /**
     * 根据对象统计数量
     * 
     * @param shippers
     * @return
     * @throws SQLException
     */
    @Override
    public int countByDto(Shippers shippers) {
        int countByDto = shippersDaoImpl.countByDto(shippers);
        return countByDto;
    }

    /**
     * 根据对象查询
     * 
     * @param shippers
     * @return
     * @throws SQLException
     */
    @Override
    public List<Shippers> findByDto(Shippers shippers) {
        List<Shippers> findByDto = shippersDaoImpl.listByDto(shippers);
        return findByDto;
    }

    /**
     * 通过id删除(物理删除)
     * 
     * @param id
     * @return
     * @throws SQLException
     */
    @Override
    public int deleteById(Integer id) {
        int deleteById = shippersDaoImpl.deleteById(id);
        return deleteById;
    }

    /**
     * 通过id列表删除(物理删除)
     * 
     * @param ids
     * @return
     * @throws SQLException
     */
    @Override
    public int deleteByIdList(ArrayList<Integer> ids) {
        int deleteByIdList = shippersDaoImpl.deleteByIdList(ids);
        return deleteByIdList;
    }

    /**
     * 通过id更新(全部更新)
     * 
     * @param shippers
     * @return
     * @throws SQLException
     */
    @Override
    public int updateById(Shippers shippers) {
        int updateById = shippersDaoImpl.updateById(shippers);
        return updateById;
    }

    /**
     * 通过id列表更新(全部更新)(更新内容相同)
     * 
     * @param shippers
     * @return
     * @throws SQLException
     */
    @Override
    public int updateStaticByIdList(Shippers shippers) {
        int updateStaticByIdList = shippersDaoImpl.updateStaticByIdList(shippers);
        return updateStaticByIdList;
    }

    /**
     * 通过id列表更新(全部更新)(更新内容不相同)
     * 
     * @param shippers
     * @return
     * @throws SQLException
     */
    @Override
    public int updateChangeByIdList(Shippers shippers) {
        int updateChangeByIdList = shippersDaoImpl.updateChangeByIdList(shippers.getShipperss());
        return updateChangeByIdList;
    }

    /**
     * 通过id更新(局部更新)
     * 
     * @param shippers
     * @return
     * @throws SQLException
     */
    @Override
    public int updatePartialById(Shippers shippers) {
        int updatePartialById = shippersDaoImpl.updatePartialById(shippers);
        return updatePartialById;
    }

    /**
     * 通过id列表更新(局部更新)(更新内容相同)
     * 
     * @param shippers
     * @return
     * @throws SQLException
     */
    @Override
    public int updateStaticPartialByIdList(Shippers shippers) {
        int updateStaticPartialByIdList = shippersDaoImpl.updateStaticPartialByIdList(shippers);
        return updateStaticPartialByIdList;
    }

    /**
     * 通过id列表更新(局部更新)(更新内容不相同)
     * 
     * @param shippers
     * @return
     * @throws SQLException
     */
    @Override
    public int updateChangePartialByIdList(Shippers shippers) {
        int updateChangePartialByIdList = shippersDaoImpl.updateChangePartialByIdList(shippers.getShipperss());
        return updateChangePartialByIdList;
    }

    /**
     * 通过id查询
     * 
     * @param id
     * @return
     * @throws SQLException
     */
    @Override
    public Shippers findById(Integer id) {
        Shippers findById = shippersDaoImpl.findById(id);
        return findById;
    }

    /**
     * 通过id列表查询
     * 
     * @param ids
     * @return
     * @throws SQLException
     */
    @Override
    public ArrayList<Shippers> findByIdList(ArrayList<Integer> ids) {
        ArrayList<Shippers> findByIdList = shippersDaoImpl.findByIdList(ids);
        return findByIdList;
    }

    /**
     * 通过对象查询id列表
     * 
     * @param shippers
     * @return
     * @throws SQLException
     */
    @Override
    public ArrayList<Integer> findIdByDto(Shippers shippers) {
        ArrayList<Integer> findIdByDto = shippersDaoImpl.findIdByDto(shippers);
        return findIdByDto;
    }

    /**
     * 清空数据(物理清空)
     * 
     * @throws SQLException
     */
    @Override
    public void clear() {
        shippersDaoImpl.clear();
    }

    /**
     * 获取快递公司下拉列表
     * 
     * @param shippers
     * @return
     */
    @Override
    public List<Select> select(Shippers shippers) {
        return shippersDaoImpl.select(shippers);
    }

}